<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>5_元素消失方案</title>
    <style>
        div {
            width: 200px;
            height: 200px;
        }
        .d1 {background-color: #f00;}
        .d1:hover {
            /* 缩小尺寸，不会释放布局空间*/
            transform: scale(0);
        }
        .d2 {background-color: #0f0;}
        .d2:hover {
            /* 修改显示模式，会释放布局空间*/
            display: none;
        }
        .d3 {background-color: #00f;}
        .d3:hover {
            /* 透明度为0，不会释放布局空间*/
            opacity: 0;
        }
    </style>
</head>
<body>
    <div class="d1"></div>
    <div class="d2"></div>
    <div class="d3"></div>
</body>
</html>